// pages/ideaDetails/ideaDetails.js
const db = wx.cloud.database();

const opinions_col = db.collection('opinions');
Page({

    /**
     * 页面的初始数据
     */
    data: {
        userPhone: "",
        userTime: "",
        userText: "",
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        // 状态栏样式
        wx.setNavigationBarColor({
            frontColor: '#000000',
            backgroundColor: '#000000',
        });
        var newId = options.id;
        this.getIdeaOne(newId);
    },

    // 请求单个详情数据
    getIdeaOne: function(oId){
        var self = this;
        opinions_col.doc(oId).get().then( res => {
            self.setData({
                userPhone: res.data.telephone,
                userTime: res.data.time,
                userText: res.data.text,
            });
        })
    },

   
})